/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.user.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.user.dto.UserMobileDTO;
import com.pig4cloud.pigx.user.entity.User;
import com.pig4cloud.pigx.user.vo.UserPageApiKeyVO;
import org.springframework.http.HttpHeaders;

/**
 * 平台用户
 *
 * @author pigx code generator
 * @date 2022-08-08 15:07:46
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param userDTO
     * @return
     */
    R userRegister(UserMobileDTO userDTO);

    /**
     * 密码解密后请求pigx-gateway中
     *
     * @param header
     * @param userMobileDTO
     * @return
     */
    R login(HttpHeaders header, UserMobileDTO userMobileDTO);

    /**
     * 用户修改邮箱
     */
    R modifyEmail(UserMobileDTO user);

    /**
     * 用户修改交易密码
     */
    R modifyMoneyPassword(UserMobileDTO user);

    /**
     * 修改用户语言
     *
     * @param user
     * @return
     */
    R modifyingUserLanguage(UserMobileDTO user);

    /**
     * 修改平台用户经纪人状态
     *
     * @param user 平台用户
     * @return R
     */
    R updateAgentById(User user);


    /**
     * 修改平台用户状态
     *
     * @param user 平台用户
     * @return R
     */
    R updateStatusById(User user);

    /**
     * 查询拥有apiKey的用户
     *
     * @param page      分页参数
     * @param condition 查询条件
     * @return {@link Page< UserPageApiKeyVO>}
     * @since 2022/10/28 16:25
     */
    Page<UserPageApiKeyVO> pageApiKey(Page<User> page, UserPageApiKeyVO condition);

    /**
     * 根据AccessKey查询用户信息
     *
     * @param accessKey 访问密钥
     * @return {@link User}
     * @since 2022/11/7 18:18
     */
    User userInfoByAccessKey(String accessKey);
}
